package com.hspedu.static_;

public class Person {
    private int id;
    private static int total = 0;
    public static int getTotalPerson(){
//        id++;//静态方法不能访问非静态成员变量
        return total;
    }
    public Person(){
        total++;
        id = total;//id
    }


}
class TestPerson{
    public static void main(String[] args) {
        System.out.println("\"Number of total is\" = " + Person.getTotalPerson());
        Person p1 = new Person();
        System.out.println("\"Number of total is\" = " + Person.getTotalPerson());

    }
}